package com.sqx.modules.task.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sqx.modules.task.entity.HelpTake;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author fang
 * @date 2021/1/7
 */
@Mapper
public interface HelpTakeDao extends BaseMapper<HelpTake> {

    int insertHelpTake(HelpTake helpTake);

    IPage<Map<String,Object>> selectRunHelpOrder(@Param("page") Page<Map<String,Object>> page, @Param("status") Integer status,
                                                 @Param("taskType") Integer taskType, @Param("orderNo") String orderNo,
                                                 @Param("phone") String phone, @Param("startTime") String startTime,
                                                 @Param("deliveryTime") String deliveryTime, @Param("userId") Long userId,
                                                 String content,String gameId,String name);

    IPage<Map<String,Object>> selectRunHelpOrderList(Page<Map<String, Object>> page, @Param("status") Integer status, @Param("phone") String phone, String startTime, String endTime, Integer taskType, Long rideUserId,String rideName);


    Integer countHelpTakeByCreateTime(@Param("time")String time,@Param("flag")Integer flag);

    Double sumMoneyBySend(@Param("time")String time,@Param("flag")Integer flag);

    Integer selectHelpTakeCount(Long userId,String startTime,String endTime);

    BigDecimal selectHelpTakeRefundMoneyByUserId(Long userId,String startTime,String endTime);

    Integer selectHelpTakeRefundCountByUserId(Long userId,String startTime,String endTime,Integer status);

    BigDecimal getMoney(@Param("dateType") String dateType, @Param("dateTime") String dateTime, @Param("taskType") Integer taskType);

    IPage<List<HashMap<String, Object>>> orderStatistics(@Param("pages") IPage<HashMap<String, Object>> pages, @Param("companyId") Long companyId, @Param("phone") String phone, @Param("userName") String userName, @Param("startTime") String startTime, @Param("endTime") String endTime);

    IPage<HashMap<String, Object>> getMyOfferOrder(IPage<HashMap<String, Object>> pages, Integer status,Long userId);

    int getEvaluateOrder(Long userId, String startTime, String endTime);

    Double getEvaluateOrderScore(Long userId, String startTime, String endTime);

    Integer selectHelperOrderCount(String time, Integer flag, Integer status);

    BigDecimal selectHelperOrderMoney(String time, Integer flag, Integer status);

    IPage<HashMap<String, Object>> getStaffOrder(IPage<HashMap<String, Object>> pages, Long userId);

    IPage<HashMap<String, Object>> getStaffUserHelp(Page<HashMap<String, Object>> pages, Long companyId);

    List<Map<String, Object>> helpTakeListExcel( @Param("status") Integer status, @Param("phone") String phone, String startTime, String endTime, Integer taskType, Long rideUserId,String rideName);

    Integer selectHelpTakeCountByUserId(Long userId,Integer status,String startTime,String endTime);

    Double selectHelpTakeMoneyCountByUserId(Long userId,Integer type);

}
